import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
// import Guangzhou from '../views/Guangzhou.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: {
      keepAlive: true,
      scrollPosition:{x:0,y:0}
    }
  },
  // {
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
    
  // }
  {
    path:'/login',
    name:'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path:'/guangzhou',
    name:'Guangzhou',
    component: () => import('../views/Guangzhou.vue')
  },
  {
    path:'/shenzhen',
    name:'Shenzhen',
    component: () => import('../views/Shenzhen.vue')
  },
  // {
  //   path:'/foshan',
  //   name:'Foshan',
  //   component: () => import('../views/Foshan.vue')
  // },
  // {
  //   path:'/dongguan',
  //   name:'Dongguan',
  //   component: () => import('../views/Dongguan.vue')
  // // },
  // {
  //   path:'/zhongshan',
  //   name:'Zhongshan',
  //   component: () => import('../views/Zhongshan.vue')
  // },
  {
    path:'/zhuhai',
    name:'Zhuhai',
    component: () => import('../views/Zhuhai.vue')
  },
  // {
  //   path:'/jiangmen',
  //   name:'Jiangmen',
  //   component: () => import('../views/Jiangmen.vue')
  // },
  // {
  //   path:'/zhaoqing',
  //   name:'Zhaoqing',
  //   component: () => import('../views/Zhaoqing.vue')
  // },
  {
    path:'/huizhou',
    name:'Huizhou',
    component: () => import('../views/Huizhou.vue')
  },
  {
    path:'/shantou',
    name:'Shantou',
    component: () => import('../views/Shantou.vue')
  },
  // {
  //   path:'/chaozhou',
  //   name:'Chaozhou',
  //   component: () => import('../views/Chaozhou.vue')
  // },
  {
    path:'/jieyang',
    name:'Jieyang',
    component: () => import('../views/Jieyang.vue')
  },
  // {
  //   path:'/shanwei',
  //   name:'Shanwei',
  //   component: () => import('../views/Shanwei.vue')
  // },
  // {
  //   path:'/zhanjiang',
  //   name:'Zhanjiang',
  //   component: () => import('../views/Zhanjiang.vue')
  // },
  {
    path:'/maoming',
    name:'Maoming',
    component: () => import('../views/Maoming.vue')
  },
  // {
  //   path:'/yangjiang',
  //   name:'Yangjiang',
  //   component: () => import('../views/Yangjiang.vue')
  // },
  // {
  //   path:'/yunfu',
  //   name:'Yunfu',
  //   component: () => import('../views/Yunfu.vue')
  // },
  // {
  //   path:'/shaoguan',
  //   name:'Shaoguan',
  //   component: () => import('../views/Shaoguan.vue')
  // },
  // {
  //   path:'/qingyuan',
  //   name:'Qingyuan',
  //   component: () => import('../views/Qingyuan.vue')
  // },
  // {
  //   path:'/meizhou',
  //   name:'Meizhou',
  //   component: () => import('../views/Meizhou.vue')
  // },
  {
    path:'/heyuan',
    name:'Heyuan',
    component: () => import('../views/Heyuan.vue')
  },
  {
    path:'*',
    name:'404',
    component: () => import('../views/noFind.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  scrollBehavior (to, from, savedPosition) { //解决跳转下一个页面底部的方法
    if (savedPosition) {
      return savedPosition
    } 
    else {
      return { x: 0, y: 0 }
    }
 },


})

export default router
